package vn.axonactive.devday.jsf.session1;

import java.io.IOException;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import vn.axonactive.devday.jsf.model.StockQuote;
import vn.axonactive.devday.jsf.model.stockfeed.StockQuoteFactory;

@ManagedBean(eager = true)
@ApplicationScoped
public class StocksBean {

	private List<StockQuote> stocks;

	@PostConstruct
	public void init() {
		try {
			stocks = StockQuoteFactory.getInstance().feedData();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
	
	public List<StockQuote> getStocks() {
		return stocks;
	}
}
